package cn.edu.hhtc.stsystem.security.utils;

/**
 * 用户id本地线程.
 * 
 * @author linyueqin
 * 
 */
public class ThreadLocalUserId {

	private static ThreadLocal<Long> userIdThread = new ThreadLocal<Long>();

	public static long getUserId() {
		try {
			return userIdThread.get();
		} catch (Exception e) {
			return 0L;
		}
	}

	public static void setUserId(long userId) {
		userIdThread.set(userId);
	}
}
